Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Update some error types to more appropriate variants #15030

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Mar 13, 2024

Closes #16440

Changes

  • Data type-related failures should raise a SchemaError. We often use a ComputeError instead, which is not as informative.

Other PRs that update one or more error types:

Example

Before

>>> from datetime import datetime, time
>>> s1 = pl.Series([datetime(1970, 1, 1, 0, 0, 1)])
>>> s2 = pl.Series([time(0, 0, 2)])
>>> s1 + s2
Traceback (most recent call last):
...
polars.exceptions.ComputeError: failed to determine supertype of datetime[μs] and time

After

>>> s1 + s2
Traceback (most recent call last):
...
polars.exceptions.SchemaError: failed to determine supertype of datetime[μs] and time

@github-actions github-actions bot added breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Mar 13, 2024
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.44%. Comparing base (a3f4ad9) to head (47c8d92).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/polars-core/src/series/any_value.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15030      +/-   ##
==========================================
+ Coverage   81.43%   81.44%   +0.01%     
==========================================
  Files        1413     1413              
  Lines      186183   186183              
  Branches     2776     2776              
==========================================
+ Hits       151615   151644      +29     
+ Misses      34048    34019      -29     
  Partials      520      520              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stinodego stinodego marked this pull request as ready for review March 13, 2024 09:54
@stinodego stinodego added this to the 1.0.0 milestone Mar 14, 2024
@stinodego stinodego requested a review from reswqa as a code owner May 23, 2024 13:19
@stinodego stinodego changed the title feat!: Change some error types to SchemaError feat!: Update some error types to more appropriate variants May 23, 2024
@stinodego stinodego removed this from the 1.0.0 milestone May 23, 2024
@ritchie46
Copy link
Member

Is this one still planned @stinodego ?

@stinodego
Copy link
Member Author

Is this one still planned @stinodego ?

Yes. I was planning to expand this PR a bit with some more error type fixes though. But it can also be merged like this and I'll pick up other error improvements separately.

Copy link

codspeed-hq bot commented Jun 5, 2024

CodSpeed Performance Report

Merging #15030 will improve performances by 16.74%

Comparing supertype-schema-error (47c8d92) with main (a3f4ad9)

Summary

⚡ 1 improvements
✅ 36 untouched benchmarks

Benchmarks breakdown

Benchmark main supertype-schema-error Change
test_tpch_q22 7.5 ms 6.4 ms +16.74%

@stinodego
Copy link
Member Author

Going to go ahead with this one. If I run into other incorrect error types, I'll open a new PR.

@stinodego stinodego merged commit a3d65df into main Jun 5, 2024
26 checks passed
@stinodego stinodego deleted the supertype-schema-error branch June 5, 2024 07:07
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use more appropriate error variants in various places across the API
2 participants